<?php
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Cache');
Zend_Loader::loadClass('Zend_Config');
Zend_Loader::loadClass('Zend_Config_Ini');
Zend_Loader::loadClass('Zend_Db');
$config = new Zend_Config_Ini('config.ini');
//var_dump($config->cache->file->dir);

$frontendOptions = array(
	'lifeTime'					=> $config->cache->file->time,
	'automatic_serialization'	=> true
);

$backendOptions = array (
	'cache_dir'					=> $config->cache->file->dir
);

$cache = Zend_Cache::factory('Core', $config->cache->type, $frontendOptions, $backendOptions);
if(!$result = $cache->load('mycache')) {
	$db = Zend_Db::factory('PDO_MYSQL',$config->production->db);
	$db->beginTransaction();
	try {
	$result = $db->fetchAll('SELECT * FROM ox_audit');
	$result = $cache->save($result,'mycache');
	}catch (Exception $e) {
		$db->rollBack();
		echo $e->getMessage();
	}
}
/*
$cache->save($config,'config');
print_r($cache->load('config'));
print_r($result);
*/
?>